package com.dmjj.cad.service.impl;

import com.dmjj.cad.dao.GraphMapper;
import com.dmjj.cad.dto.CategoryDTO;
import com.dmjj.cad.dto.GraphDTO;
import com.dmjj.cad.service.GraphService;
import com.dmjj.cad.vo.GraphSearchVO;
import com.dmjj.cadcommon.base.BaseMapper;
import com.dmjj.cadcommon.base.BaseServiceImpl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;


/**
 * 元素管理表业务处理接口
 * @Author zhangxue
 * @Date 2019-04-19 10:39:23
 */
@Service
public class GraphServiceImpl extends BaseServiceImpl<GraphDTO, Long> implements GraphService {

    private static final Log LOGGER = LogFactory.getLog(GraphServiceImpl.class);

    @Autowired
    private GraphMapper mapper;

    @Override
    protected BaseMapper<GraphDTO, Long> getMapper() {
        return mapper;
    }

    /**
     * 元素管理表列表
     * @Author zhangxue
     * @Date 2019-04-19 10:39:23
     * @Param
     * @Return
     */
    @Override
    public List<GraphDTO> list4Page(GraphDTO entity, Integer pageNum, Integer... pageSize) {
        return super.list4Page(entity, pageNum, pageSize);
    }

    /**
     * 元素管理表列表（无分页）
     * @Author zhangxue
     * @Date 2019-04-19 10:39:23
     * @Param
     * @Return
     */
    @Override
    public List<GraphDTO> listByCondition(GraphDTO entity) {
        return super.listByCondition(entity);
    }

    /**
     * 查询元素管理表详情信息
     * @Author zhangxue
     * @Date 2019-04-19 10:39:23
     * @Param
     * @Return
     */
    @Override
    public GraphDTO queryOneByPk(Long id) {
        return super.queryOneByPk(id);
    }

    /**
     * 保存元素管理表信息
     * @Author zhangxue
     * @Date 2019-04-19 10:39:23
     * @Param
     * @Return
     */
    @Override
    @Transactional
    public Long save(GraphDTO entity) {
        return super.save(entity);
    }

    /**
     * 删除元素管理表信息
     * @Author zhangxue
     * @Date 2019-04-19 10:39:23
     * @Param
     * @Return
     */
    @Override
    @Transactional
    public Integer delete(Long id) {
        return super.delete(id);
    }


    /**
     * @Author zhangxue
     * @Description //TODO 获取所有与当前floorplanid相同类别的floorplan
     * @Date 10:13 2019/4/23
     * @Param
     * @return
     **/
    @Override
    public List<Map<String, Object>> queryAllSameCategoryFloorplan(Long floorplanid) {
        return mapper.queryAllSameCategoryFloorplan(floorplanid);
    }


    /**
     * @Author zhangxue
     * @Description //TODO 通过平面图id数组查询所有元素信息
     * @Date 10:40 2019/4/23
     * @Param
     * @return
     **/
    @Override
    public List<Map<String, Object>> queryAllGraphByFloorplan(Map<String,Object> floorPlanIdArr) {
        return mapper.queryAllGraphByFloorplan(floorPlanIdArr);
    }

    @Override
    public List<Map<String,Object>> queryAllFixCategory(GraphSearchVO graphSearchVO) {
        return mapper.queryAllFixCategory(graphSearchVO);
    }

    @Override
    public List<Map<String, Object>> queryAllFixGraph(Map<String, Object> categoryMap) {
        return mapper.queryAllFixGraph(categoryMap);
    }

    @Override
    public Integer deleteGraphSon(Long id) {
        return mapper.deleteGraphSon(id);
    }
}
